package conson.tech.manage.message.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;


@Slf4j
@Component
public class ScheduleMessageJob {

    /**
     *
     *发布定时时间到了的消息
     * @return
     */
    @XxlJob("scheduledReleaseMsg")
    public ReturnT<String> scheduledReleaseMsg(String param) {
        XxlJobLogger.log("ScheduleMessageJob --> 发布定时时间到了的消息 定时器开始");
        log.info("ScheduleJobProvider --> 发布定时时间到了的消息 定时器开始, time{}", LocalDateTime.now());
        try {

            //TODO 业务逻辑

            XxlJobLogger.log("ScheduleMessageJob --> 发布定时时间到了的消息 定时器完成, time{}", LocalDateTime.now());
            log.info("ScheduleMessageJob --> 发布定时时间到了的消息 定时器完成, time{}", LocalDateTime.now());
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            log.error("ScheduleMessageJob --> 发布定时时间到了的消息 定时器异常, time{}", LocalDateTime.now(), e);
            return ReturnT.FAIL;
        }
    }
}
